<div class="panel panel-default">
  <div class="panel-heading">Send <%= media_type.to_s.upcase %> Message</div>
  <form class="form-horizontal panel-body" role="form" method="post" action="/apps/<%= app.id %>/message" rel="message_form">
    <input type="hidden" name="message[type]" value="<%= media_type %>" />
    <div class="form-group">
      <label for="message-from-user" class="col-sm-2 control-label">From</label>
      <div class="col-sm-10">
        <select id="message-from-user" class="form-control" name="message[user]"><%= users_select_options(app.users) %></select>
      </div>
    </div>

    <div class="form-group">
      <label for="message-content" class="col-sm-2 control-label"><%= media_type.to_s.upcase %></label>
      <div class="col-sm-10">
        <select id="message-content" class="form-control" name="message[media_id]">
          <%= medias_select_options(app.medias.select{|m| m[:type] == media_type.to_s}) %>
        </select>
      </div>
    </div>

    <% if media_type.to_s == 'voice' %>
    <div class="form-group">
      <label for="message-recognition" class="col-sm-2 control-label">Recognition</label>
      <div class="col-sm-10">
        <input type="text" id="message-recognition" class="form-control" name="message[recognition]" placeholder="keep blank for ignore" />
      </div>
    </div>
    <% end %>

    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-default">Send</button>
      </div>
    </div>

  </form>
</div>